import line_search


# this file contains default line search parameters

def wolfe_line_search(f, g, x0, d, f0, g0):
    return line_search.wolfe(f, g, x0, d, f0, g0, 0.25, 0.75, 1.0, 10000.0, 100)


def create_gll_wolfe(m, s):
    def gll_wolfe_line_search(f, g, x0, d, f0, g0):
        return line_search.gll_wolfe(f, g, x0, d, f0, g0, 0.25, 0.75, 1.0, 10000.0, 100, s, m)

    return gll_wolfe_line_search


def show_result(f, x, it_n, it_ls, msg, fc, gc, hc):
    # print("%d %d %d+%d %s" % (it_n, it_ls, fc.count, gc.count, f(x)))
    print('found solution x*= %s' % x)
    print('terminate reason: %s' % msg)
    print('Newton iterations: %d' % it_n)
    print('line search iterations: %d' % it_ls)
    print('f() calls: %d' % fc.count)
    print('g() calls: %d' % gc.count)
    print('G() calls: %d' % hc.count)
    print('f*= %s' % f(x))
